﻿namespace D.UtilEventbus
{
    /// <summary>
    /// 事件发布者，就是发送事件到EventBus事件总线的一方，事件发布者调用Post()方法，将事件发给EventBus。
    /// 可以在程序的任何地方，调用EventBus的post()方法，发送事件给EventBus
    /// </summary>
    public interface IPublisher
    {
        /// <summary>
        /// 事件发布
        /// </summary>
        /// <typeparam name="TEventData"></typeparam>
        /// <param name="eventData"></param>
        void Publish<TEventData>(TEventData eventData) where TEventData : IEventData;

        ///// <summary>
        ///// 同步发布指定事件，并指定事件源
        ///// </summary>
        ///// <typeparam name="T">事件数据类型</typeparam>
        ///// <param name="eventSource">事件源，触发事件的对象</param>
        ///// <param name="eventData">事件数据</param>
        //public void Publish<T>(object eventSource, T eventData) where T : IEventData;

        ///// <summary>
        ///// 同步发布指定事件
        ///// </summary>
        ///// <param name="eventType">事件数据类型</param>
        ///// <param name="eventData">事件数据</param>
        //public void Publish(Type eventType, IEventData eventData);

        ///// <summary>
        ///// 同步发布指定事件，并指定事件源
        ///// </summary>
        ///// <param name="eventType">事件数据类型</param>
        ///// <param name="eventSource">事件源，触发事件的对象</param>
        ///// <param name="eventData">事件数据</param>
        //public void Publish(Type eventType, object eventSource, IEventData eventData);

        ///// <summary>
        ///// 异步发布指定事件
        ///// </summary>
        ///// <typeparam name="TEventData">事件数据类型</typeparam>
        ///// <param name="eventData">事件数据</param>
        //public Task PublishAsync<TEventData>(TEventData eventData) where TEventData : IEventData;

        ///// <summary>
        ///// 异步发布指定事件，并指定事件源
        ///// </summary>
        ///// <typeparam name="TEventData">事件数据类型</typeparam>
        ///// <param name="eventSource">事件源，触发事件的对象</param>
        ///// <param name="eventData">事件数据</param>
        //public Task PublishAsync<TEventData>(object eventSource, TEventData eventData) where TEventData : IEventData;

        ///// <summary>
        ///// 异步发布指定事件
        ///// </summary>
        ///// <param name="eventType">事件数据类型</param>
        ///// <param name="eventData">事件数据</param>
        //public Task PublishAsync(Type eventType, IEventData eventData);

        ///// <summary>
        ///// 异步发布指定事件，并指定事件源
        ///// </summary>
        ///// <param name="eventType">事件数据类型</param>
        ///// <param name="eventSource">事件源，触发事件的对象</param>
        ///// <param name="eventData">事件数据</param>
        //public Task PublishAsync(Type eventType, object eventSource, IEventData eventData);
    }
}
